/**
 *  @(#)  IFAAAuthenticator  module    1.0  2017/03/24
 *
 *  Copyright  (c)  2017,  IFAA  and/or  its  affiliates.  All  rights  reserved.
 *
 *  Redistribution  and  use  in  source  and  binary  forms,  with  or  without
 *  modification,  are  permitted  provided  that  the  following  conditions  are  met:
 *
 *  -Redistribution  of  source  code  must  retain  the  above  copyright  notice,  this
 *    list  of  conditions  and  the  following  disclaimer.
 *
 *  -Redistribution  in  binary  form  must  reproduce  the  above  copyright  notice,
 *    this  list  of  conditions  and  the  following  disclaimer  in  the  documentation
 *    and/or  other  materials  provided  with  the  distribution.
 *
 *  Neither  the  name  of  IFAA  or  the  names  of  contributors  may
 *  be  used  to  endorse  or  promote  products  derived  from  this  software  without
 *  specific  prior  written  permission.
 *
 *  This  software  is  provided  "AS  IS,"  without  a  warranty  of  any  kind.  ALL
 *  EXPRESS  OR  IMPLIED  CONDITIONS,  REPRESENTATIONS  AND  WARRANTIES,  INCLUDING
 *  ANY  IMPLIED  WARRANTY  OF  MERCHANTABILITY,  FITNESS  FOR  A  PARTICULAR  PURPOSE
 *  OR  NON-INFRINGEMENT,  ARE  HEREBY  EXCLUDED.  IFAA,  ORG.
 *  AND  ITS  LICENSORS  SHALL  NOT  BE  LIABLE  FOR  ANY  DAMAGES  SUFFERED  BY  LICENSEE
 *  AS  A  RESULT  OF  USING,  MODIFYING  OR  DISTRIBUTING  THIS  SOFTWARE  OR  ITS
 *  DERIVATIVES.  IN  NO  EVENT  WILL  IFAA  OR  ITS  LICENSORS  BE  LIABLE  FOR  ANY  LOST
 *  REVENUE,  PROFIT  OR  DATA,  OR  FOR  DIRECT,  INDIRECT,  SPECIAL,  CONSEQUENTIAL,
 *  INCIDENTAL  OR  PUNITIVE  DAMAGES,  HOWEVER  CAUSED  AND  REGARDLESS  OF  THE  THEORY
 *  OF  LIABILITY,  ARISING  OUT  OF  THE  USE  OF  OR  INABILITY  TO  USE  THIS  SOFTWARE,
 *  EVEN  IF  IFAA  HAS  BEEN  ADVISED  OF  THE  POSSIBILITY  OF  SUCH  DAMAGES.
 *
 *  You  acknowledge  that  this  software  is  not  designed,  licensed  or  intended
 *  for  use  in  the  design,  construction,  operation  or  maintenance  of  any
 *  nuclear  facility.
 *
 */
package com.ifaa.sdk.auth.message;

import com.ifaa.sdk.auth.Constants;

/**
 * 
 * @author junsui.ljs
 * @version $Id: FingerPrintMessage.java, v 0.1 2014 4:38:54 junsui.ljs Exp $
 */
public class AuthenticatorMessage {


    /**
     * Key of result
     */
    public static final String KEY_RESULT                   = "KEY_RESULT";
    public static final String KEY_MESSAGE                  = "KEY_MESSAGE";
    public static final String KEY_OPERATIONT_TYPE          = "KEY_OPERATIONT_TYPE";
    public static final String KEY_CHECKING_POLICY          = "KEY_CHECKING_POLICY";
    public static final String KEY_REGISTERED_TOKENS        = "KEY_REGISTERED_TOKENS";
    public static final String KEY_DEVICEID                 = "DEVICEID";
    public static final String KEY_AUTHENTICATE_METHOD      = "KEY_AUTHENTICATE_METHOD";
    public static final String KEY_TRY_TIME                 = "KEY_TRY_TIME";
    public static final String KEY_TIME_OUT                 = "KEY_TIME_OUT";
    public static final String KEY_CALLBACK_TYPE            = "KEY_CALLBACK_TYPE";
    public static final String FINGERPRINTS_NUM             = "FINGERPRINTS_NUM";
    public static final String KEY_USERSTATUS               = "KEY_USERSTATUS";
    public static final String KEY_USERID                   = "KEY_USERID";
    public static final String KEY_STATUS                   = "KEY_STATUS";
    public static final String KEY_VENDOR_TYPE              = "KEY_VENDOR_TYPE";

    // for log
    public static final String KEY_FULL_LOG                 = "KEY_FULL_LOG";
    public static final String KEY_ERROR_LOG                = "KEY_ERROR_LOG";
    public static final String KEY_PF_LOG                   = "KEY_PERFORMANCE_LOG";
    public static final String KEY_ERROR_CODE               = "KEY_ERROR_CODE";
    public static final String KEY_ERROR_STRING             = "KEY_ERROR_STRING";
    public static final String KEY_VENDOR_ERROR_CODE        = "KEY_VENDOR_ERROR_CODE";
    public static final String KEY_OPERATION                = "KEY_OPERATION";



    public static final String KEY_AUTHENTICATOR_TYPE       = "KEY_AUTHENTICATOR_TYPE";
    public static final String KEY_EXTRA_PARAMS             = "KEY_EXTRA_PARAMS";
//    public static final String KEY_VERSION                  = "KEY_VERSION";


    /**
     * message type
     */

    // TODO Query token and Login will be Removed
    public static final int    MSG_INIT_REQUEST             = 0;
    public static final int    MSG_LOGIN_REQUEST            = 1;
    public static final int    MSG_REGISTER_REQUEST         = 2;
    public static final int    MSG_AUTHENTICATOR_REQUEST    = 3;
    public static final int    MSG_DEREGISTER_REQUEST       = 4;
    public static final int    MSG_QUERYTOKENS_REQUEST      = 5;

    public static final int    MSG_INIT_RESPONSE            = 6;
    public static final int    MSG_LOGIN_RESPONSE           = 7;
    public static final int    MSG_REGISTER_RESPONSE        = 8;
    public static final int    MSG_AUTHENTICATOR_RESPONSE   = 9;
    public static final int    MSG_DEREGISTER_RESPONSE      = 10;
    public static final int    MSG_QUERYTOKENS_RESPONSE     = 11;
    public static final int    MSG_GET_DEVICE_ID            = 12;
    public static final int    MSG_QUERY_FINGERPRINTS       = 13;
    public static final int    MSG_QUERY_USERSTATUS         = 14;
    public static final int    MSG_PREPARE_KEYPARE          = 15;
    public static final int    MSG_OPEN_FINGERPRINT_MANAGER = 16;
    public static final int    MSG_CHECK_UPDATE             = 17;
    public static final int    MSG_UPDATE_TA	            = 18;

    protected int              authenticatorType            = Constants.TYPE_FINGERPRINT;

    /**
     * type of the message
     */
    protected int              type                         = 1;

    /**
     * version of the message
     */
    protected int              version                      = 1;

    /**
     * data of the message
     */
    protected String           data;

    /**
     * 额外的参数，如手环的蓝牙地址
     */
    protected String           extraParams;

    protected boolean          checkPolicyOnly              = false;

    public boolean isCheckPolicyOnly() {
        return checkPolicyOnly;
    }

    public void setCheckPolicyOnly(boolean checkPolicyOnly) {
        this.checkPolicyOnly = checkPolicyOnly;
    }

    /**
     * 
     */
    public AuthenticatorMessage() {
        super();
    }

    /**
     * Constructor
     * @param type
     * @param version
     */
    public AuthenticatorMessage(int type, int version) {
        super();
        this.type = type;
        this.version = version;
    }

    /**
     * @param type
     * @param version
     * @param data
     */
    public AuthenticatorMessage(int type, int version, String data) {
        super();
        this.type = type;
        this.version = version;
        this.data = data;
    }

    /**
     * Getter method for property <tt>type</tt>.
     * 
     * @return property value of type
     */
    public int getType() {
        return type;
    }

    /**
     * Setter method for property <tt>type</tt>.
     * 
     * @param type value to be assigned to property type
     */
    public void setType(int type) {
        this.type = type;
    }

    /**
     * Getter method for property <tt>version</tt>.
     * 
     * @return property value of version
     */
    public int getVersion() {
        return version;
    }

    /**
     * Setter method for property <tt>version</tt>.
     * 
     * @param version value to be assigned to property version
     */
    public void setVersion(int version) {
        this.version = version;
    }

    /**
     * Getter method for property <tt>data</tt>.
     * 
     * @return property value of data
     */
    public String getData() {
        return data;
    }

    /**
     * Setter method for property <tt>data</tt>.
     * 
     * @param data value to be assigned to property data
     */
    public void setData(String data) {
        this.data = data;
    }

    public int getAuthenticatorType() {
        return authenticatorType;
    }

    public void setAuthenticatorType(int authenticatorType) {
        this.authenticatorType = authenticatorType;
    }

    public String getExtraParams() {
        return extraParams;
    }

    public void setExtraParams(String extraParams) {
        this.extraParams = extraParams;
    }
}
